package neurons;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import synapses.SynapseInterface;

public class NeuronLayer {

	private Set<NeuronInterface> neurons;

	public NeuronLayer() {

	}

	public NeuronLayer(Set<NeuronInterface> neurons) {
		if (neurons != null) {
			this.neurons = neurons;
			// for (NeuronInterface neuronInterface : this.neurons) {
			// System.out.println("neuron : " + neuronInterface.toString());
			// }
		} else {
			this.neurons = new HashSet<NeuronInterface>();
		}
	}

	public Collection<SynapseInterface> getInSynapses() {
		Collection<SynapseInterface> synapses = new HashSet<SynapseInterface>();
		for (NeuronInterface neuron : neurons) {
			for (SynapseInterface synapseInterface : neuron.getInSynapses()) {
				synapses.add(synapseInterface);
			}
		}
		return synapses;
	}

	public Collection<SynapseInterface> getOutSynapses() {
		Collection<SynapseInterface> synapses = new HashSet<SynapseInterface>();
		for (NeuronInterface neuron : neurons) {
			for (SynapseInterface synapseInterface : neuron.getOutSynapses()) {
				synapses.add(synapseInterface);
			}
		}
		return synapses;
	}
}
